package ch08;

import java.io.FileOutputStream;
import java.io.PrintStream;

class ExceptionEx11 {
	public static void main(String args[]) {
		PrintStream ps = null;
		FileOutputStream fos=null;

		try {
			fos = new FileOutputStream("c:/save/error.log");
			ps = new PrintStream(fos);

			System.out.println(1);			
			System.out.println(2);
			System.out.println(3);
			System.out.println(0/0);
			System.out.println(4);
		} catch (Exception ae)	{
			ae.printStackTrace(ps);
			ps.println("error message: " + ae.getMessage());
		}
		System.out.println(6);
	}
}
/*
1
2
3
java.lang.ArithmeticException: / by zero
	at ch08.ExceptionEx11.main(ExceptionEx11.java:8)
error message: / by zero
6
*/